import java.util.HashMap;

/**
 * Created by WhiteBlue on 15/6/8.
 */
public class Test {

    public static void main(String args[]) {
        System.gc();
        String a = "abcde";
        long start = Runtime.getRuntime().freeMemory();
        HashMap map = new HashMap();
        for (int i = 0; i < 90000000; i++) {
            map.put(i, a);
        }
        // 快要计算的时,再清理一次
        System.gc();
        long end = Runtime.getRuntime().freeMemory();
        System.out.println("一个HashMap对象占内存:" + (end - start));
    }
}
